#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int m[4005], a[4005], t[4005];
int lm, la, lt;

struct node {
	int a, b;
	bool operator < (const node& t) const {
		return a * b < t.a * t.b;
	}
}q[1005];

void mul(int m[], int b, int t[]) {
	for (int i = 1; i <= lt; i++) t[i] = 0;
	for (int i = 1; i <= lm; i++) t[i] += m[i] * b;
	lm += 4;
	for (int i = 1; i < lm; i++) {
		t[i + 1] += t[i] / 10;
		t[i] %= 10;
	}
	while (t[lm] == 0 && lm > 1) lm--;
	for (int i = 1; i <= lm; i++) m[i] = t[i];
}

void div(int m[], int b, int t[]) {
	for (int i = 1; i <= lt; i++) t[i] = 0;
	int r = 0;
	for (int i = lm; i >= 1; i--) {
		r = r * 10 + m[i];
		t[i] = r / b;
		r %= b;
	}
	lt = lm;
	while (t[lt] == 0 && lt > 1) lt--;
}

bool cmp(int a[], int t[]) {
	if (la != lt) return la < lt;
	for (int i = lt; i ; i--) {
		if (a[i] != t[i]) return a[i] < t[i];
	}
	return false;
}

void upd(int a[], int t[]) {
	if (cmp(a, t)) {
		for (int i = lt; i >= 0; i--) a[i] = t[i];
		la = lt;
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin >> n;
	for (int i = 0; i <= n; i++) cin >> q[i].a >> q[i].b;
	sort(q + 1, q + n + 1);
	m[++lm] = q[0].a;
	for (int i = 1; i <= n; i++) {
		div(m, q[i].b, t);
		upd(a, t);
		mul(m, q[i].a, t);
	}
	for (int i = la; i ; i--) cout << a[i];
	return 0;
}